apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: postgres
      app.kubernetes.io/part-of: peertube
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app.kubernetes.io/name: postgres
        app.kubernetes.io/part-of: peertube
    spec:
      containers:
        - env:
            - name: OPENDKIM_DOMAINS
              valueFrom:
                configMapKeyRef:
                  key: OPENDKIM_DOMAINS
                  name: env
            - name: OPENDKIM_RequireSafeKeys
              valueFrom:
                configMapKeyRef:
                  key: OPENDKIM_RequireSafeKeys
                  name: env
            - name: PEERTUBE_ADMIN_EMAIL
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_ADMIN_EMAIL
                  name: env
            - name: PEERTUBE_DB_HOSTNAME
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_DB_HOSTNAME
                  name: env
            - name: PEERTUBE_DB_PASSWORD
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_DB_PASSWORD
                  name: env
            - name: PEERTUBE_DB_SSL
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_DB_SSL
                  name: env
            - name: PEERTUBE_DB_USERNAME
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_DB_USERNAME
                  name: env
            - name: PEERTUBE_SMTP_DISABLE_STARTTLS
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_SMTP_DISABLE_STARTTLS
                  name: env
            - name: PEERTUBE_SMTP_FROM
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_SMTP_FROM
                  name: env
            - name: PEERTUBE_SMTP_HOSTNAME
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_SMTP_HOSTNAME
                  name: env
            - name: PEERTUBE_SMTP_PORT
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_SMTP_PORT
                  name: env
            - name: PEERTUBE_SMTP_TLS
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_SMTP_TLS
                  name: env
            - name: PEERTUBE_TRUST_PROXY
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_TRUST_PROXY
                  name: env
            - name: PEERTUBE_WEBSERVER_HOSTNAME
              valueFrom:
                configMapKeyRef:
                  key: PEERTUBE_WEBSERVER_HOSTNAME
                  name: env
            - name: POSTFIX_myhostname
              valueFrom:
                configMapKeyRef:
                  key: POSTFIX_myhostname
                  name: env
            - name: POSTGRES_DB
              valueFrom:
                configMapKeyRef:
                  key: POSTGRES_DB
                  name: env
            - name: POSTGRES_PASSWORD
              valueFrom:
                configMapKeyRef:
                  key: POSTGRES_PASSWORD
                  name: env
            - name: POSTGRES_USER
              valueFrom:
                configMapKeyRef:
                  key: POSTGRES_USER
                  name: env
          image: postgres:13-alpine
          name: postgres
          ports:
            - name: default
              containerPort: 5432
              protocol: TCP
          resources:
            limits:
              cpu: 15m
              memory: 30Mi
            requests:
              cpu: 5m
              memory: 20Mi
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgres-claim0
      volumes:
        - name: postgres-claim0
          hostPath:
            path: /var/lib/peertube/db
            type: Directory
